#ifndef DIALOG_H
#define DIALOG_H

#include <QDialog>
#include "qdicethread.h"
#include <QThread>
#include <QTimer>

namespace Ui {
class Dialog;
}

class Dialog : public QDialog
{
    Q_OBJECT
private:
    int dSeq, dDiceValue; //sample 13-3
    QDiceThread threadA;
    QTimer dTimer; //sample 13-3
protected:
    void closeEvent(QCloseEvent *event);

public:
    explicit Dialog(QWidget *parent = 0);
    ~Dialog();

private slots:
    void threadA_started();
    void threadA_finished();
//    void threadA_newValue(int seq, int diceValue); //sample 13 -1
    void on_threadStart_clicked();

    void on_start_clicked();

    void on_pause_clicked();

    void on_stopThread_clicked();

    void on_clearText_clicked();

    void onTimeOut(); //定期器处理槽函数  sample 13-3
private:
    Ui::Dialog *ui;
};

#endif // DIALOG_H
